<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header"></head>
<!-- 我要提现页面 -->
<body class="gray-bg" style="background-color: white;">
	<br>
	<table  th:object="${hatchetAgent}" style="width:75%;">
    	<tr height="35" >
    		<td width="5%" ></td>
    		<td width="35%" style="font-weight: bold;border-bottom:1px solid #E1DEDE;">姓名：</td>
    		<td style="border-bottom:1px solid #E1DEDE;" width="35%" th:text="${hatchetAgent.accountName}" ></td>
    	</tr>
     	<tr height="35" >
    		<td ></td>
    		<td  style="font-weight: bold;border-bottom:1px solid #E1DEDE;">身份证：</td>
    		<td style="border-bottom:1px solid #E1DEDE;" th:text="${hatchetAgent.idCardNo}" ></td>
    	</tr>
    	<tr height="35" >
    		<td ></td>
    		<td style="font-weight: bold;border-bottom:1px solid #E1DEDE;">银行名称：</td>
    		<td style="border-bottom:1px solid #E1DEDE;" th:text="${hatchetAgent.issbankId}" ></td>
    	</tr>
    	<tr height="35" >
    		<td ></td>
    		<td  style="font-weight: bold;border-bottom:1px solid #E1DEDE;">银行卡号：</td>
    		<td style="border-bottom:1px solid #E1DEDE;" th:text="${hatchetAgent.bankAccount}" ></td>
    	</tr>
    	<tr height="35" >
    		<td ></td>
    		<td style="font-weight: bold;border-bottom:1px solid #E1DEDE;">账户余额：</td>
    		<td style="border-bottom:1px solid #E1DEDE;" >
    			<span id="totalMoney" th:text="${hatchetAgent.totalMoney}" style="color: red"></span>元
    		</td>
    	</tr>
    	 <tr height="45" >
    		<td ></td>
    		<td style="font-weight: bold;">请填金额：</td>
    		<td >
				<input style="height: 35px;width: 150px;" type="text" id="tixianMoney" name="tixianMoney" placeholder="请在这里输入提现金额"/>
    		</td>
    	</tr> 
    	<tr height="45" >
    		<td ></td>
    		<td align="right">
    			
    		</td>
    		<td >
    			<button type="button" onclick="tixian()" class="btn btn-info btn-md">确认提现</button>
    		</td>
    	</tr>
   		<tr height="35" >
    		<td ></td>
    		<td colspan="2" style="font-size: 18px">注意事项：</td>
    	</tr>
    	<tr height="35" >
    		<td ></td>
    		<td colspan="2">
    				1.每次提现不能低于<span style="color: red">100</span>元,每天最多只能提现一次
    		</td>
    		<!-- <td style="font-size: 16px">
    		
    		</td> -->
    	</tr>
    	<tr height="35" >
    		<td ></td>
    		<td colspan="2">2.非节假日最迟第二天18：00之前到账</td>
    		<!-- <td style="font-size: 16px" >
   				
    		</td> -->
    	</tr>
    	<tr></tr>
    </table>
	<!--  <div class="wrapper wrapper-content animated fadeInRight ibox-content">
		<form class="form-horizontal m-t" id="form-hatchetAgent-detail" th:object="${hatchetAgent}">
		    <div class="form-group">
				<label class="col-sm-3 control-label">姓名：</label>
				<div class="form-control-static" th:text="${hatchetAgent.accountName}">
				</div>
				<label class="col-sm-3 control-label">身份证：</label>
				<div class="form-control-static" th:text="${hatchetAgent.idCardNo}">
				</div>
				<label class="col-sm-3 control-label">银行名称：</label>
				<div class="form-control-static" th:text="${hatchetAgent.issbankId}">
				</div>
				<label class="col-sm-3 control-label">银行卡号：</label>
				<div class="form-control-static" th:text="${hatchetAgent.bankAccount}">
				</div>
				<label class="col-sm-3 control-label">请输入金额：</label>
				<div class="form-control-static" >
				</div>
			</div>
			<div class="form-group" >
				<label class="col-sm-4 control-label">
					<
				</label>
			</div>
		</form>
		<div class="form-group">
			<table>
				<tr>
					<td width="50px"></td>
					
				</tr>
				<tr>
					<td width="50px"></td>
					<td style="font-size: 16px">
						
					</td>
				</tr>
				<tr>
					<td width="50px"></td>
					<td style="font-size: 16px">
					
					</td>
				</tr>
				<tr></tr>
			</table>
		</div>
    </div>  -->
     
    
    <div th:include="include :: footer"></div>
    <script th:inline="javascript">
     	var prefix = ctx+"system/hatchetMoneyChangeForDLS";
      	function tixian(){
      		var reg = /(^[1-9]([0-9]+)?(\.[0-9]{1,2})?$)|(^(0){1}$)|(^[0-9]\.[0-9]([0-9])?$)/;
      		var totalMoney =Number($("#totalMoney").text()) ;
      		var tixianMoney= Number($("#tixianMoney").val()) ;
      	    if (!reg.test(tixianMoney)){
      	  		$.modal.alertError("您的金额输入格式不正确");
           		$("#tixianMoney").val("");
                return ;
            }
    	   if(tixianMoney<100){
       	 	$.modal.alertError("提现金额不能小于100元");
       	 	$("#tixianMoney").val("");
       	 	return ;
           }
           if(tixianMoney>totalMoney){
       		$.modal.alertError("提现金额不能大于账户余额");
           	$("#tixianMoney").val("");
           	return ;
            }  
           //做提现的业务
           $.ajax({
		        url:prefix+"/getTixian", //请求后台
		        dataType:"json",
		        type: "GET",
		       	data:"money="+tixianMoney,
		        success:function(re){
		        	$("#tixianMoney").val("");
		      		if(re.status=="SUCCESS"){
		      			$.modal.msgSuccess(re.msg);
		      			//重新显示剩下金额
		      			var nowmoney = re.nowmoney;
		      			$("#totalMoney").text(nowmoney);
		      			return;
		      		} else if(re.status=="FAIL"){
		      			$.modal.alertError(re.msg);
		      		}
		        }
		    });
      	} 
    </script> 
</body>
</html>